home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_07 / feather / function.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-23  |  1.5 KB  |  42 lines

  1. static int fn_a (void);     /* Internal linkage (first decl'n) */
  2. int fn_a (void);            /* Remains internal linkage */
  3. extern int fn_a (void);     /* Remains internal linkage; extern has no effect */
  4.  
  5. int fn_b (void);            /* External linkage (first decl'n) */
  6. static int fn_b (void);     /* Error - fn_b has external linkage */
  7.  
  8. extern int fn_c (void);     /* External linkage (first decl'n) */
  9.  
  10. static int fn_d (void);     /* Internal linkage (first decl'n) */
  11.  
  12. int main (void)
  13. {
  14.     int fn_a (void);        /* Remains internal linkage */
  15.     int fn_b (void);        /* Remains external linkage */
  16.     static int fn_a (void); /* Error - block scope must not be static */
  17.  
  18.     int fn_e (void);        /* External linkage (first decl'n) */
  19.     int fn_f (void);        /* External linkage (first decl'n) */
  20.  
  21.     int fn_c, fn_d;         /* Variable declarations hide the functions */
  22.                             /* declarations in outer scope */
  23.  
  24.     {
  25.         int fn_c ();        /* Remains external linkage */
  26.         int fn_d ();        /* Error - hidden fn_d has internal linkage */
  27.                             /* Illustrates subtle point `#2' */
  28.  
  29.         /* fn_c here refers to the external linkage function once more */
  30.     }
  31.  
  32.     /* fn_c here refers to the variable */
  33.     return 0;
  34. }
  35.  
  36. int fn_e (void);            /* Remains external linkage */
  37.                             /* Illustrates subtle point `#1' */
  38. static int fn_f (void);     /* Error - fn_f has external linkage */
  39.  
  40. /* End of File */ 
  41.  
  42.